package com.tools.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.tools.entity.Student;

@Repository(value="studentMapper")
public interface StudentMapper {

	@Select(value="${sql}")
	@Results(value={
			@Result(id=true,property="id",column="id"),
			@Result(property="name",column="name"),
			@Result(property="sex",column="sex"),
			@Result(property="age",column="age"),
			@Result(property="phone",column="phone"),
			@Result(property="address",column="address"),
			@Result(property="email",column="email")
	})
	List<Student> getList(@Param(value="sql")String sql);
	
	@Results(value={
			@Result(id=true,property="id",column="id"),
			@Result(property="name",column="name"),
			@Result(property="sex",column="sex"),
			@Result(property="age",column="age"),
			@Result(property="phone",column="phone"),
			@Result(property="address",column="address"),
			@Result(property="email",column="email")
	})
	Student fetchById(@Param(value="id")int id);
}
